package com.hsl.housaileibot001.model.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

/**
 * 用户登录DTO
 */
@Data
@Schema(description = "用户登录请求")
public class UserLoginDTO {

    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空")
    @Schema(description = "用户名", required = true, example = "admin")
    private String username;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    @Schema(description = "密码", required = true, example = "admin123")
    private String password;

    /**
     * 设置用户名，自动去除两端空格
     */
    public void setUsername(String username) {
        this.username = username != null ? username.trim() : null;
    }

    /**
     * 设置密码，自动去除两端空格
     */
    public void setPassword(String password) {
        this.password = password != null ? password.trim() : null;
    }
}

